#include "_afxstat.h"

AFX_MODULE_STATE _afxBaseModuleState;
THREAD_LOCAL(_AFX_THREAD_STATE, _afxThreadState);
THREAD_LOCAL(AFX_MODULE_THREAD_STATE,_afxModuleThreadState)
AFX_MODULE_THREAD_STATE* AfxGetModuleThreadState()
{
	//return _afxModuleThreadState.GetData();
	return AfxGetModuleState()->m_thread.GetData();
}

_AFX_THREAD_STATE* AfxGetThreadState()
{
	return _afxThreadState.GetData();}

//THREAD_LOCAL(_AFX_THREAD_STATE,_afxThreadState);
//AFX_MODULE_STATE _afxBaseModuleState;
AFX_MODULE_STATE* AfxGetAppModuleState()
{
	return &_afxBaseModuleState;
}
AFX_MODULE_STATE* AfxGetModuleState()
{
	_AFX_THREAD_STATE* pState = _afxThreadState.GetData();
	AFX_MODULE_STATE* pResult;
	if(NULL != pState)
		pResult = pState->m_pModuleState;
	else
		pResult = AfxGetAppModuleState();
	if(NULL==pResult)
		_asm{int 3}
	return pResult;
}


